# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=rocs
pkgver=20.04.3
pkgrel=0
arch="all !armhf !mips !mips64"
url="https://kde.org/applications/education/org.kde.rocs"
pkgdesc="Graph Theory IDE"
license="GPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only) AND GFDL-1.2-only"
makedepends="extra-cmake-modules qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev qt5-qtxmlpatterns-dev karchive-dev kconfig-dev kcoreaddons-dev kcrash-dev kdeclarative-dev ki18n-dev kitemviews-dev ktexteditor-dev kxmlgui-dev kdoctools-dev boost-dev grantlee-dev"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/rocs-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang $pkgname-dev"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build

	# TestTgfFileFormat, TestRocs1FileFormat, TestRocs2FileFormat, and
	# graphtheory-test_graphoperations are broken
	# TestProject requires OpenGL
	local skipped_tests="("
	local tests="
		TestTgfFileFormat
		TestRocs1FileFormat
		TestRocs2FileFormat
		graphtheory-test_graphoperations
		TestProject"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="b561e8864a700c832d36ce8fb645d29c09c4c9dcf34a01649ad6448b9d00a25945134821753ebeef56a607c3c66424a59d8a2372ae5561185fd37691709bfd5d  rocs-20.04.3.tar.xz"
